package com.forekonw.demo7;

import sun.dc.pr.PRError;

public class Y extends X{
    private String school;

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }
//方法的重写(方法的覆盖):1.要有继承关系  2.子类可以重写父类的方法(规则:方法的名称,参数,返回值类型都相同)
    public void ShowInfo(){
        System.out.println("姓名"+ this.getName()+"年龄"+this.getAge()+"所在学校"+this.getSchool());
    }

    public static void main(String[] args) {
        Y y = new Y();
        y.setAge(20);
        y.setSchool("shenyang");
        y.setName("tony");
        y.ShowInfo();
    }
}
